package view.room;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.BevelBorder;


class RoomInfo extends JPanel{
	private static final long serialVersionUID = 1L;

	JButton btRoomId 		= new JButton("ROOM");
	JTextField tfRoomType	= new JTextField(15);
	JTextField tfStatus		= new JTextField(15);
	JTextField tfPrice		= new JTextField(15);
	JTextField tfCustomerId	= new JTextField(15);
	JTextField tfCustomer	= new JTextField(15);
	JTextField tfCheckID	= new JTextField(15);
	JTextField tfInDate		= new JTextField(15);
	JTextField tfOutDate	= new JTextField(15);
	JTextField tfPhone		= new JTextField(15);
	
	public RoomInfo(){
		setPreferredSize(new Dimension(10, 150));
		setBorder(new BevelBorder(BevelBorder.LOWERED));
		setLayout(new GridBagLayout());
		GridBagConstraints gbc = new GridBagConstraints();
		gbc.insets = new Insets(2, 10, 2, 10);
		
		btRoomId.setPreferredSize(new Dimension(80,40));
		
		gbc.fill = GridBagConstraints.HORIZONTAL;
		gbc.weightx = 1.0;
//		gbc.weighty = 1.0;
		int y = 0;
		
		gbc.gridy = y;
			gbc.ipady = 60; 
			gbc.gridx = 0;	gbc.gridheight = 4; add(btRoomId, gbc);
			gbc.gridheight = 1;
			gbc.ipady = 0;
		gbc.gridy = y++;
		gbc.anchor = GridBagConstraints.EAST;
			gbc.gridx = 1;	add(new JLabel("Type"), gbc);
			gbc.gridx = 2; add(tfRoomType, gbc);
			gbc.gridx = 3; add(new JLabel("Price"), gbc);
			gbc.gridx = 4; add(tfPrice, gbc);
		gbc.gridy = y++;
			gbc.gridx = 1; add(new JLabel("Status"), gbc);
			gbc.gridx = 2; add(tfStatus, gbc);
			
		gbc.gridy = y++;
			gbc.gridx = 2; add(new JLabel("Mã hóa đơn"), gbc);
			gbc.gridx = 3; add(tfCheckID, gbc);
			gbc.gridx = 4; add(new JLabel("Mã khách hàng"), gbc);
			gbc.gridx = 5; add(tfCustomerId, gbc);
			gbc.gridx = 6; add(new JLabel("Tên khách hàng"), gbc);
			gbc.gridx = 7; add(tfCustomer, gbc);
		gbc.gridy = y++;
			gbc.gridx = 2; add(new JLabel("Liên hệ"), gbc);
			gbc.gridx = 3; add(tfPhone, gbc);
			gbc.gridx = 4; add(new JLabel("Ngày đến"), gbc);
			gbc.gridx = 5; add(tfInDate, gbc);
			gbc.gridx = 6; add(new JLabel("Ngày đi"), gbc);
			gbc.gridx = 7; add(tfOutDate, gbc);
	}
	
	public void updateRoom(int roomId){
		if (roomId<0)
			btRoomId.setText("ROOM");
		else btRoomId.setText(roomId + "");
	}
}